//
//  AppController.m
//  Shake and Bake
//
//  Created by Antoine Quint on 26/06/07.
//  Copyright 2007 Fuchsia Design. All rights reserved.
//

#import "AppController.h"
#import "Canvas.h"

@implementation AppController

- (IBAction)open:(id)sender 
{ 
  NSOpenPanel *panel = [NSOpenPanel openPanel]; 
  [panel beginSheetForDirectory:nil 
                           file:nil 
                          types:[NSArray arrayWithObjects:@"xml", @"svg", nil] 
                 modalForWindow:[canvas window] 
                  modalDelegate:self 
                 didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) 
                    contextInfo:NULL];
} 

- (void)openPanelDidEnd:(NSOpenPanel *)openPanel 
             returnCode:(int)returnCode 
            contextInfo:(void *)x 
{ 
  if (returnCode == NSOKButton) {
		[canvas loadFile:[openPanel filename]];
  } 
} 

@end
